<template>
  <div>
    <a @click="changeIdx(0)"> 菜单0 </a>
    <a @click="changeIdx(1)"> 菜单1 </a>
    <a @click="changeIdx(2)"> 菜单2 </a>
    <a @click="changeIdx(3)"> 菜单3 </a>
    <a @click="changeIdx(4)"> 菜单4 </a>
  </div>
</template>

<script>
import { mapState } from "../../vuex/index";
export default {
  name: "Nav",
  computed:{
    ...mapState(['navIdx'])
  },
  methods:{
    changeIdx(index){
      this.$store.commit('changeIdx',index)
    }
  }
};
</script>

<style></style>
